﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 工业设备监控系统.Models
{
    public class Register
    {
        public int Id { get; set; }
        public string Name { get; set; } = string.Empty;          // 如 "温度"
        public string Unit { get; set; } = "";                    // 如 "°C", "MPa"

        public int Address { get; set; }                         // Modbus 地址：40001
        public string DataType { get; set; } = "Int16";          // Int16, Float, Bool
        public double Value { get; set; }                        // 当前值
        public DateTime LastUpdated { get; set; } = DateTime.Now;

        public double? MinValue { get; set; }                    // 最小正常值
        public double? MaxValue { get; set; }                    // 最大正常值（用于报警）

        public bool IsAlarmEnabled { get; set; } = true;         // 是否启用报警

        // 外键：属于哪个设备
        public int DeviceId { get; set; }

        public Color StatusColor { get; set; } // 新增的状态颜色属性

        public virtual Device Device { get; set; } = null;
    }
}